package org.homeorganiser.flex.util;

import javax.sql.DataSource;

import org.springframework.jdbc.core.JdbcTemplate;

public class DatabaseInitializer {
	private final JdbcTemplate template;

    public DatabaseInitializer(DataSource ds) {
        this.template = new JdbcTemplate(ds);
        createTableUser();
    }

    public void createTableUser() {
        String sql = "CREATE TABLE IF NOT EXISTS USER (" + "ID INT AUTO_INCREMENT PRIMARY KEY, " +"USER_ID VARCHAR(15)," +"PASSWORD VARCHAR(15)," + "FIRST_NAME VARCHAR(50), "
            + "LAST_NAME VARCHAR(50), " + "ADDRESS VARCHAR(50), " + "CITY VARCHAR(50), " + "STATE VARCHAR(20), " + "ZIP VARCHAR(20), "
            + "PHONE VARCHAR(50), " + "EMAIL VARCHAR(50), " + "SECQUES VARCHAR(100)," + "SECANS VARCHAR(100))";
        this.template.execute(sql);
    }

    
}
